from selenium.webdriver.common.by import By
from base.mp.base import BasePage, BaseHandle
class LoginPage(BasePage):
    def __init__(self):     # 父类初始化
        super().__init__()
        self.mobile=By.XPATH,'//*[@id="app"]/div/div/form/div[1]/div/div/input'
        self.code=By.XPATH,'//*[@id="app"]/div/div/form/div[2]/div/div/input'
        self.login_btn=By.XPATH,'//*[@id="app"]/div/div/form/div[4]/div/button'
    def find_moblie(self):
        return self.get_element(self.mobile)
    def find_code(self):
        return self.get_element(self.code)
    def find_login_btn(self):
        return self.get_element(self.login_btn)
class LoginHandle(BaseHandle):
    def __init__(self):
        self.login_page=LoginPage()
    def input_moblie(self,mobile):
        self.input_text(self.login_page.find_moblie(),mobile)
    def input_code(self,code):
        self.input_text(self.login_page.find_code(),code)
    def click_login_btn(self):
        self.login_page.find_login_btn().click()
class LoginProxy:
    def __init__(self):
        self.login_handle=LoginHandle()
    def test_login(self,mobile,code):
        self.login_handle.input_moblie(mobile)
        self.login_handle.input_code(code)
        self.login_handle.click_login_btn()